
package com.example.xunai.repository;

import com.example.xunai.entity.Conversation;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;

public interface ConversationRepository extends JpaRepository<Conversation, Long> {
    List<Conversation> findByUserIdOrderByUpdateTimeDesc(Long userId);
    Conversation findByUserIdAndId(Long userId, Long id);

    // 新增：根据会话ID查询
    Conversation findBySessionId(String sessionId);
    Conversation findByUserIdAndSessionId(Long userId, String sessionId);
}